#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/5/4 14:59
# @Author  : 新猿异码
# @Site    : https://gitee.com/chshao/autotest
# @CSDN    : https://blog.csdn.net/m0_37576542?type=blog
# @File    : deletepyc.py
# @Description  : 删除pyc文件
import os
import shutil


def delete_pyc(mPath):
    for root, dirName, fileList in os.walk(mPath):
        for fileName in fileList:
            if fileName.endswith('.pyc'):
                os.remove(os.path.join(root, fileName))
        if os.path.exists(os.path.join(root, '__pycache__')):
            shutil.rmtree(os.path.join(root, '__pycache__'))


delete_pyc(r'D:\workspace\AutoTest-Python\autotest')
